package com.kabigon.tiny.consumer;

import com.kabigon.tiny.common.model.User;
import com.kabigon.tiny.common.service.UserService;
import com.kabigon.tiny.proxy.ServiceProxyFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * 简易服务消费者示例
 */
@Slf4j
public class EasyConsumerExample {

    public static void main(String[] args) {
        // todo 需要获取 UserService 的实现类对象
        UserService userService = ServiceProxyFactory.getProxy(UserService.class);
        User user = new User();
        user.setName("kabigon");
        //调用
        User newUser = userService.getUser(user);
        if (newUser != null) {
            log.info(newUser.getName());
        } else {
            log.info("user == null");
        }

        int number = userService.getNumber();
        log.info("numbr：{}", number);

    }
}
